import Vue from "vue";
import App from "./App.vue";
import router from "./router"; // router路由管理
import store from "./store";
import echarts from "echarts";
import XEUtils from "xe-utils";
import "./assets/less/common.less";
import "./plugins/element-ui/element.js";
import "./assets/less/plugins.reset.less";
import "./assets/iconfont/iconfont.css";
import "./filters"; // 过滤器

// 启用ant-design-vue组件
import Antd from "ant-design-vue"; // 引入Ant Design Vue组件
import "ant-design-vue/dist/antd.css"; // 挂载到vue中

// vxe-table --> vxe-table-plugin-antd 用于兼容 ant-design-vue 组件库
import VXETable from "vxe-table";
import VXETablePluginAntd from "vxe-table-plugin-antd";

// 打印js
import Print from "./utils/print";

// 引入音频文件
import audio from "./assets/12599.mp3";

// 表单校验
import myValidate from "./utils/myValidate.js";

// 获取权限-指令
import permission from "@/directive/permission";
// 四舍五入-指令
import roundingNumber from "@/directive/roundingNumber";

// 图片标注插件引入
import { fabric } from "fabric";
VXETable.use(VXETablePluginAntd);

window.XEUtils = XEUtils;

Vue.use(permission);
Vue.use(Antd);

// 注册播放音频事件到Vue实例上
Vue.prototype.playAudio = () => {
  let buttonAudio = document.getElementById("eventAudio");
  buttonAudio.setAttribute("src", audio);
  buttonAudio.play();
};
// 注册停止播放音频事件到Vue实例上
Vue.prototype.pauseAudio = () => {
  let buttonAudio = document.getElementById("eventAudio");
  buttonAudio.pause();
};

/* 输入框数字失去焦点后自动保留2位小数（四舍五入）-指令 */
Vue.use(roundingNumber);

// 注册打印
Vue.use(Print);
Vue.use(fabric);

Vue.config.productionTip = false;
Vue.prototype.$echarts = echarts;

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
